<?php

namespace Database\Factories;

use App\Models\ESCluster;
use App\Models\Task;
use Illuminate\Database\Eloquent\Factories\Factory;

class ReportFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {

        $result = [
            ['diagnosis_item' => '过放电',      'type' => '经济性', 'level' => '正常', 'localtion' => '1#电池簇', 'advice' => '' ],
            ['diagnosis_item' => '电解液分解',  'type' => '安全性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '单体内阻',    'type' => '安全性',  'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '能量恢复率',  'type' => '可靠性',  'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '充放电能量极差', 'type' => '安全性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '正负极材料锐化', 'type' => '安全性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '负极析锂',    'type' => '经济性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => 'SEI膜劣化',    'type' => '安全性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '能量保持率',  'type' => '可靠性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '热失控',  'type' => '安全性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '锂枝晶演化',  'type' => '安全性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '内阻一致性',  'type' => '安全性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '能量效率',  'type' => '安全性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '绝缘异常',  'type' => '安全性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '衰减异常',  'type' => '安全性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ],
            ['diagnosis_item' => '电压异常（欧姆内阻/扩散内阻）',  'type' => '安全性', 'level' => '正常', 'localtion' => '1#电池簇','advice' => '' ]
        ];

        return [
            'dev_id' => $this->faker->randomElement(ESCluster::all()->pluck('id')),
            'dev_type' => 'App\Models\ESCluster', 
            'result'  => $result,
            // 'advice' => $advice,
            'task_id' => $this->faker->randomElement(Task::all()->pluck('id')),
            'remarks' => '备注',
        ];
    }
}
